From 40930c5acc213a9541806861342eb217ba0e9312 Mon Sep 17 00:00:00 2001 From: Yves-Alexis Perez Date: Fri, 2 Feb 2018 10:40:47 +0100 Subject: [PATCH] Revert "bpf: avoid false sharing of map refcount with max_entries" This reverts commit 5cb917aa1f1e03df9a4c29b363e3900d73508fa8 which is commit be95a845cc4402272994ce290e3ad928aff06cb9 upstream. This commit heavily modifies the bpf_map structure to split it on two cachelines and prevent sharing reference counter with other, read-only fields in order to mitigate Spectre attacks. This modification changes the ABI, so revert the mitigation for now since the infrastructure is not yet complete for Spectre mitigation anyway. Gbp-Pq: Topic debian Gbp-Pq: Name revert-bpf-avoid-false-sharing-of-map-refcount-with-.patch --- include/linux/bpf.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 7995940d4187..75ffd3b2149e 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -36,10 +36,7 @@ struct bpf_map_ops { }; struct bpf_map { - /* 1st cacheline with read-mostly members of which some - * are also accessed in fast-path (e.g. ops, max_entries). - */ - const struct bpf_map_ops *ops ____cacheline_aligned; + atomic_t refcnt; enum bpf_map_type map_type; u32 key_size; u32 value_size; @@ -47,15 +44,10 @@ struct bpf_map { u32 map_flags; u32 pages; bool unpriv_array; - /* 7 bytes hole */ - - /* 2nd cacheline with misc members to avoid false sharing - * particularly with refcounting. - */ - struct user_struct *user ____cacheline_aligned; - atomic_t refcnt; - atomic_t usercnt; + struct user_struct *user; + const struct bpf_map_ops *ops; struct work_struct work; + atomic_t usercnt; }; struct bpf_map_type_list { -- 2.30.2